Skip to content

fix(unparser): use to_rfc3339 for default TIMESTAMPTZ formatting#21295

Merged
alamb merged 1 commit intoapache:mainfrom
spiceai:sgrebnov/0401-timestamp_with_tz_to_string
Apr 3, 2026
Merged

fix(unparser): use to_rfc3339 for default TIMESTAMPTZ formatting#21295
alamb merged 1 commit intoapache:mainfrom
spiceai:sgrebnov/0401-timestamp_with_tz_to_string

Conversation

@sgrebnov
Copy link
Copy Markdown
Member

@sgrebnov sgrebnov commented Apr 1, 2026

Which issue does this PR close?

Rationale for this change

The default timestamp_with_tz_to_string uses DateTime<Tz>.to_string(), which produces literals like 2025-09-15 11:00:00 +00:00 that are not supported by multiple dialects (e.g. DuckDB, BigQuery). Switching to to_rfc3339() produces valid ISO 8601 / RFC 3339 strings (e.g. 2025-09-15T11:00:00+00:00) that are broadly compatible.

What changes are included in this PR?

  • Changed the default Dialect::timestamp_with_tz_to_string implementation from dt.to_string() to dt.to_rfc3339()
  • Removed now-redundant timestamp_with_tz_to_string overrides from DuckDBDialect and BigQueryDialect (they produced equivalent RFC 3339-compatible output via custom format strings)
  • Updated test expectations to match the new default format

Are these changes tested?

Yes, existing tests in unparser::expr::tests have been updated to reflect the new format.

Manually verifying updated format supported by PostgreSQL, MySQL, SQLite, DuckDB and BigQuery.

Are there any user-facing changes?

Yes — timestamp-with-timezone literals are now formatted as RFC 3339 (2025-09-15T11:00:00+00:00) instead of the previous Display format (2025-09-15 11:00:00 +00:00). Dialects that need a different format can still override timestamp_with_tz_to_string.

@github-actions github-actions bot added the sql SQL Planner label Apr 1, 2026
@sgrebnov sgrebnov marked this pull request as ready for review April 1, 2026 10:22
@AndreaBozzo
Copy link
Copy Markdown
Contributor

Seems solid, waiting for someone else to take another look

Copy link
Copy Markdown
Contributor

@nuno-faria nuno-faria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sgrebnov.

@alamb alamb enabled auto-merge April 3, 2026 12:35
@alamb
Copy link
Copy Markdown
Contributor

alamb commented Apr 3, 2026

🚀

@alamb alamb disabled auto-merge April 3, 2026 12:36
@alamb alamb enabled auto-merge April 3, 2026 12:36
@alamb
Copy link
Copy Markdown
Contributor

alamb commented Apr 3, 2026

Close/reopen PR to rerun checks

@alamb alamb closed this Apr 3, 2026
auto-merge was automatically disabled April 3, 2026 12:56

Pull request was closed

@alamb alamb reopened this Apr 3, 2026
@alamb alamb enabled auto-merge April 3, 2026 12:56
@alamb alamb added this pull request to the merge queue Apr 3, 2026
Merged via the queue into apache:main with commit 5b0938d Apr 3, 2026
69 checks passed
@alamb
Copy link
Copy Markdown
Contributor

alamb commented Apr 3, 2026

This was the first PR that got merged using the new PR merge queue from @blaginin

It seems to have gone really well

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Apr 3, 2026

🤔 but a bunch of the tests seem to have failed after merge to main 5b0938d

Screenshot 2026-04-03 at 9 16 15 AM

@blaginin
Copy link
Copy Markdown
Member

blaginin commented Apr 3, 2026

I think that's correct - Rust tests are not required-to-merge (and hence not ran by the merge queue yet) - only dev.yaml does. The plan is to wait for a few days and do the same operation for the rest of the CI

For now, Rust checks should work as before ("push" not "merge group" checks)

@blaginin
Copy link
Copy Markdown
Member

blaginin commented Apr 3, 2026

image

@AndreaBozzo
Copy link
Copy Markdown
Contributor

I think that's correct - Rust tests are not required-to-merge (and hence not ran by the merge queue yet) - only dev.yaml does. The plan is to wait for a few days and do the same operation for the rest of the CI

For now, Rust checks should work as before ("push" not "merge group" checks)

This could be a bit counterintuitive, but for now we can maybe monitor the CI and see how it goes

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Apr 3, 2026

I think that's correct - Rust tests are not required-to-merge (and hence not ran by the merge queue yet) - only dev.yaml does. The plan is to wait for a few days and do the same operation for the rest of the CI
For now, Rust checks should work as before ("push" not "merge group" checks)

This could be a bit counterintuitive, but for now we can maybe monitor the CI and see how it goes

Yeah, what i find counter intuitive is that the main commit list now looks like this commit failed CI:

https://github.com/apache/datafusion

Screenshot 2026-04-03 at 9 38 50 AM

Looks like main is broken since we enabled the queue:
https://github.com/apache/datafusion/commits/main/

Screenshot 2026-04-03 at 9 39 47 AM

@blaginin
Copy link
Copy Markdown
Member

blaginin commented Apr 3, 2026

oh, that should be an easy fix!

blaginin added a commit that referenced this pull request Apr 3, 2026
@blaginin
Copy link
Copy Markdown
Member

blaginin commented Apr 3, 2026

#21343

github-merge-queue bot pushed a commit that referenced this pull request Apr 3, 2026
- Related to
#21295 (comment)

- Follow on to #21239

## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->

- Closes #.

## Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

## What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

## Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

## Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unparser: use to_rfc3339 for TIMESTAMPTZ formatting

5 participants